package com.es.disped.common.constant;

public class WeChat {

	/**
	 * accessToken请求接口 
	 */
	private static String accessTokenUrl="https://api.weixin.qq.com/cgi-bin/token?";
	/**
	 * 模板消息请求接口
	 */
	private static String templateMessageUrl="https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN_VAL";
	/**
	 * 消息详情跳转链接
	 */
	private static String TemplateMessageDetailUrl="http://esh.free.idcfengye.com/disped-web";
	
	/**
	 * @author Anson<br>
	 *	Copyright by EasyShare 2019<br>
	 *  
	 *  All right reserved<br>
	 *
	 *  Created on 2019年6月19日 下午8:47:30<br>
	 *  微信消息类型
	 */
	public enum MessageType
	{
		TEXT("本文消息","text"),IMAGE("图片消息","image"),VOICE("语音消息","voice"),VIDEO("视频消息","video"),
		LINK("链接消息","link"),LOCATION("位置消息","location"),EVENT("事件消息","event"),EVENT_SUBSCRIBE("关注","subscribe"),
		EVENT_UNSUBSCRIBE("取消关注","unsubscribe"),CLICK("点击菜单","CLICK"),VIEW("视图菜单","view");
		
		String name;
		String value;
		
		private MessageType(String name, String value) {
			this.setName(name);
			this.setValue(value);
		}		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
	}
	
	/**
	 * @author Anson<br>
	 *	Copyright by EasyShare 2019<br>
	 *  
	 *  All right reserved<br>
	 *
	 *  Created on 2019年6月17日 下午1:15:36<br>
	 *  微信模板信息
	 */
	public enum TemplateMessage
	{
		COURSE_RESERVATION_SUCCESS("课程预约成功通知","PDI8SwmeInfh5YHDTivjemste1V-kUcNnoJ6D7uSe0g"),
		COURSE_NOTICE("上课提醒","9IkiqzdU8LkpdjaGKaTS2XBbH2dOhb1JHj0u5Hqm8P0");
		
		String name;
		String value;
		
		private TemplateMessage(String name, String value) {
			this.setName(name);
			this.setValue(value);
		}		
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public String getValue() {
			return value;
		}
		public void setValue(String value) {
			this.value = value;
		}
	}
	
	public static String getAccessTokenUrl()
	{
		return accessTokenUrl;
	}
	
	public static String getTemplateMessageUrl(String accessToken) {
		setTemplateMessageUrl(accessToken);
		return templateMessageUrl;
	}

	private static void setTemplateMessageUrl(String accessToken) {
		WeChat.templateMessageUrl=WeChat.templateMessageUrl.replace("ACCESS_TOKEN_VAL", accessToken);
	}

	public static void setAccessTokenUrl(String accessTokenUrl) {
		WeChat.accessTokenUrl = accessTokenUrl;
	}

	public static String getTemplateMessageDetailUrl() {
		return TemplateMessageDetailUrl;
	}

	public static void setTemplateMessageDetailUrl(String templateMessageDetailUrl) {
		TemplateMessageDetailUrl = templateMessageDetailUrl;
	}

}
